package member1;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JLabel;
import java.awt.Color;
import java.awt.Font;

@SuppressWarnings("serial")
public class Output extends JPanel {
	
	private JScrollPane scrollPane;
	private JTextArea textArea;
	private JLabel lblNewLabel;
	private Data6[] data;
	private JLabel lblNewLabel_1;
	
	/**
	 * Create the panel.
	 */
	public Output() {
		setBackground(Color.ORANGE);
		setLayout(null);
		add(getScrollPane());
		add(getLblNewLabel_1());

	}
	private JScrollPane getScrollPane() {
		if (scrollPane == null) {
			scrollPane = new JScrollPane();
			scrollPane.setBounds(12, 51, 404, 251);
			scrollPane.setViewportView(getTextArea());
			scrollPane.setColumnHeaderView(getLblNewLabel());
		}
		return scrollPane;
	}
	private JTextArea getTextArea() {
		if (textArea == null) {
			textArea = new JTextArea();
			textArea.setFont(new Font("Monospaced", Font.PLAIN, 11));
		}
		return textArea;
	}
	private JLabel getLblNewLabel() {
		if (lblNewLabel == null) {
			lblNewLabel = new JLabel("이름        주소        연락처                    이메일                    나이");
			lblNewLabel.setFont(new Font("굴림", Font.PLAIN, 11));
		}
		return lblNewLabel;
	}
	
	public void setD (Data6 [] data){
		this.data = data;
		textArea.setText("");
		for(int i=0;i<data.length;i++){
			if (data[i] == null)
				continue;
			System.out.println(i);
			textArea.append(data[i].name+"	");
			textArea.append(data[i].address+"	");
			textArea.append(data[i].phone+"		");
			textArea.append(data[i].email+"		");
			textArea.append(data[i].age+"");
			textArea.append("\n");
		}
	}
	private JLabel getLblNewLabel_1() {
		if (lblNewLabel_1 == null) {
			lblNewLabel_1 = new JLabel("데이터 출력  페이지");
			lblNewLabel_1.setForeground(Color.WHITE);
			lblNewLabel_1.setFont(new Font("나눔손글씨 펜", Font.PLAIN, 25));
			lblNewLabel_1.setBackground(Color.DARK_GRAY);
			lblNewLabel_1.setOpaque(true);
			lblNewLabel_1.setBounds(139, 21, 157, 20);
		}
		return lblNewLabel_1;
	}
}
